package main.test;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.util.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import java.io.IOException;

public class Neihe {
    public static void main(String[] args) throws IOException {
        /*HtmlUnitDriver  driver = new HtmlUnitDriver();
        driver.setJavascriptEnabled(true);
        driver.get("https://www.yidaiyilu.gov.cn");
        String html = driver.getPageSource();
        System.out.println(html);*/
/*        String cookieV = "";
        WebClient webClient = new WebClient(BrowserVersion.CHROME);
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);//当HTTP的状态非200时是否抛出异常, 这里选择不需要
        webClient.getPage("https://www.yidaiyilu.gov.cn");
        webClient.getPage("https://www.yidaiyilu.gov.cn");
        for (Cookie cookie : webClient.getCookieManager().getCookies()) {
            cookieV += cookie.getName()+"="+cookie.getValue()+";";
        }
//        System.out.println(cookieV);*/
//        System.setProperty("webdriver.chrome.driver", "D:\\360MoveData\\Users\\yym\\Desktop\\chromedriver_win32\\chromedriver.exe");
//        ChromeOptions chromeOptions = new ChromeOptions();
//        chromeOptions.addArguments("--headless");
//        WebDriver driver = new ChromeDriver(chromeOptions);
//        driver.get("https://www.yidaiyilu.gov.cn/wcm.files/upload/CMSydylgw/201811/201811131040028.jpg");
//        driver.get("https://www.yidaiyilu.gov.cn/wcm.files/upload/CMSydylgw/201811/201811131040028.jpg");
//        System.out.println(driver.getPageSource());
        String ht = " <img src=\"/wcm.files/upload/CMSydylgw/201709/201709120355021.jpg\" width=\"600px\">";
        String[] hmtl = ht.split("src=\"");
        System.out.println(hmtl.length);
    }
}
